package logic

import (
	"bluebell/dao/mysql"
	"errors"

	"go.uber.org/zap"
)

func DeletePost(postID int64) {
	// 把参数传递到dao层进行处理
	err := mysql.DeletePost(postID)
	if err != nil {
		zap.L().Error("mysql.DeletePost error", zap.Error(err))
		return
	}
}

// DeleteUserPublicPost 删除用户发布的帖子
func DeleteUserPublicPost(userID, postID int64) (err error) {
	err = mysql.DeletePostByUserID(userID, postID)
	if err != nil {
		if errors.Is(err, errors.New("post not found or user not authorized")) {
			return err
		}
		return err
	}
	return nil
}
func DeleteUser(userID int64) {
	//传递到dao层
	err := mysql.DeleteUser(userID)
	if err != nil {
		zap.L().Error("mysql.DeleteUser error", zap.Error(err))
		return
	}
}
